package com.kun.gulimall.guliproduct.response;

import com.kun.gulimall.guliproduct.domain.PmsCategory;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.List;

@Data
@ToString
@NoArgsConstructor
public class CategoryTree {

    /**
     * 分类id
     */
    private Long catId;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 父分类id
     */
    private Long parentCid;

    /**
     * 层级
     */
    private Integer catLevel;

    /**
     * 是否显示[0-不显示，1显示]
     */
    private Integer showStatus;

    /**
     * 排序
     */
    private Integer sort;

    /**
     * 图标地址
     */
    private String icon;

    /**
     * 计量单位
     */
    private String productUnit;

    /**
     * 商品数量
     */
    private Integer productCount;

    private List<CategoryTree> children;

    public CategoryTree(PmsCategory category) {
        this.catId = category.getCatId();
        this.name = category.getName();
        this.parentCid = category.getParentCid();
        this.catLevel = category.getCatLevel();
        this.showStatus = category.getShowStatus();
        this.sort = category.getSort();
        this.icon = category.getIcon();
        this.productUnit = category.getProductUnit();
        this.productCount = category.getProductCount();
    }
}
